package com.ruoyi.cms.blog.service.impl;

import com.ruoyi.cms.blog.domain.CmsMode;
import com.ruoyi.cms.blog.mapper.CmsModeMapper;
import com.ruoyi.cms.blog.service.ICmsModeService;
import com.ruoyi.common.core.domain.AjaxResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor
public class CmsModeServiceImpl implements ICmsModeService {
    private final CmsModeMapper cmsModeMapper;
    @Override
    public AjaxResult select() {
        List<CmsMode> modes = cmsModeMapper.selectCmsModeList();
        return AjaxResult.success(modes);
    }

    @Override
    public int insert(CmsMode mode) {
        return cmsModeMapper.insertCmsMode(mode);
    }

    @Override
    public int update(CmsMode mode) {
        return cmsModeMapper.updateCmsMode(mode);
    }

    @Override
    public int delete(Long id) {
        return cmsModeMapper.deleteCmsModeById(id);
    }

    @Override
    public CmsMode getCmsMode() {
        return cmsModeMapper.getCmsMode();
    }

    /**
     * 查询金额模式
     *
     * @param id 金额模式主键
     * @return 金额模式
     */
    @Override
    public CmsMode selectCmsModeById(Long id)
    {
        return cmsModeMapper.selectCmsModeById(id);
    }
}
